<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/gui/widgets/qabstractspinbox.cpp -->
<head>
  <title>Qt 4.3: QAbstractSpinBox Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QAbstractSpinBox Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1>
<p>The QAbstractSpinBox class provides a spinbox and a line edit to display values. <a href="#details">More...</a></p>
<pre> #include &lt;QAbstractSpinBox&gt;</pre><p>Inherits <a href="qwidget.html">QWidget</a>.</p>
<p>Inherited by <a href="qdatetimeedit.html">QDateTimeEdit</a>, <a href="qdoublespinbox.html">QDoubleSpinBox</a>, and <a href="qspinbox.html">QSpinBox</a>.</p>
<ul>
<li><a href="qabstractspinbox-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h3>Public Types</h3>
<ul>
<li><div class="fn"/>enum <b><a href="qabstractspinbox.html#ButtonSymbols-enum">ButtonSymbols</a></b> { UpDownArrows, PlusMinus, NoButtons }</li>
<li><div class="fn"/>enum <b><a href="qabstractspinbox.html#CorrectionMode-enum">CorrectionMode</a></b> { CorrectToPreviousValue, CorrectToNearestValue }</li>
<li><div class="fn"/>flags <b><a href="qabstractspinbox.html#StepEnabledFlag-enum">StepEnabled</a></b></li>
<li><div class="fn"/>enum <b><a href="qabstractspinbox.html#StepEnabledFlag-enum">StepEnabledFlag</a></b> { StepNone, StepUpEnabled, StepDownEnabled }</li>
</ul>
<a name="properties"></a>
<h3>Properties</h3>
<p><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td width="45%" valign="top"><ul>
<li><div class="fn"/><b><a href="qabstractspinbox.html#accelerated-prop">accelerated</a></b> : bool</li>
<li><div class="fn"/><b><a href="qabstractspinbox.html#acceptableInput-prop">acceptableInput</a></b> : const bool</li>
<li><div class="fn"/><b><a href="qabstractspinbox.html#alignment-prop">alignment</a></b> : Qt::Alignment</li>
<li><div class="fn"/><b><a href="qabstractspinbox.html#buttonSymbols-prop">buttonSymbols</a></b> : ButtonSymbols</li>
<li><div class="fn"/><b><a href="qabstractspinbox.html#correctionMode-prop">correctionMode</a></b> : CorrectionMode</li>
<li><div class="fn"/><b><a href="qabstractspinbox.html#frame-prop">frame</a></b> : bool</li>
</ul></td><td valign="top"><ul>
<li><div class="fn"/><b><a href="qabstractspinbox.html#keyboardTracking-prop">keyboardTracking</a></b> : bool</li>
<li><div class="fn"/><b><a href="qabstractspinbox.html#readOnly-prop">readOnly</a></b> : bool</li>
<li><div class="fn"/><b><a href="qabstractspinbox.html#specialValueText-prop">specialValueText</a></b> : QString</li>
<li><div class="fn"/><b><a href="qabstractspinbox.html#text-prop">text</a></b> : const QString</li>
<li><div class="fn"/><b><a href="qabstractspinbox.html#wrapping-prop">wrapping</a></b> : bool</li>
</ul>
</td></tr>
</table></p>
<ul>
<li><div class="fn"/>56 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qabstractspinbox.html#QAbstractSpinBox">QAbstractSpinBox</a></b> ( QWidget * <i>parent</i> = 0 )</li>
<li><div class="fn"/><b><a href="qabstractspinbox.html#dtor.QAbstractSpinBox">~QAbstractSpinBox</a></b> ()</li>
<li><div class="fn"/>Qt::Alignment <b><a href="qabstractspinbox.html#alignment-prop">alignment</a></b> () const</li>
<li><div class="fn"/>ButtonSymbols <b><a href="qabstractspinbox.html#buttonSymbols-prop">buttonSymbols</a></b> () const</li>
<li><div class="fn"/>CorrectionMode <b><a href="qabstractspinbox.html#correctionMode-prop">correctionMode</a></b> () const</li>
<li><div class="fn"/>virtual void <b><a href="qabstractspinbox.html#fixup">fixup</a></b> ( QString &amp; <i>input</i> ) const</li>
<li><div class="fn"/>bool <b><a href="qabstractspinbox.html#acceptableInput-prop">hasAcceptableInput</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qabstractspinbox.html#frame-prop">hasFrame</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#interpretText">interpretText</a></b> ()</li>
<li><div class="fn"/>bool <b><a href="qabstractspinbox.html#accelerated-prop">isAccelerated</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qabstractspinbox.html#readOnly-prop">isReadOnly</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qabstractspinbox.html#keyboardTracking-prop">keyboardTracking</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#accelerated-prop">setAccelerated</a></b> ( bool <i>on</i> )</li>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#alignment-prop">setAlignment</a></b> ( Qt::Alignment <i>flag</i> )</li>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#buttonSymbols-prop">setButtonSymbols</a></b> ( ButtonSymbols <i>bs</i> )</li>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#correctionMode-prop">setCorrectionMode</a></b> ( CorrectionMode <i>cm</i> )</li>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#frame-prop">setFrame</a></b> ( bool )</li>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#keyboardTracking-prop">setKeyboardTracking</a></b> ( bool <i>kt</i> )</li>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#readOnly-prop">setReadOnly</a></b> ( bool <i>r</i> )</li>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#specialValueText-prop">setSpecialValueText</a></b> ( const QString &amp; <i>txt</i> )</li>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#wrapping-prop">setWrapping</a></b> ( bool <i>w</i> )</li>
<li><div class="fn"/>QString <b><a href="qabstractspinbox.html#specialValueText-prop">specialValueText</a></b> () const</li>
<li><div class="fn"/>virtual void <b><a href="qabstractspinbox.html#stepBy">stepBy</a></b> ( int <i>steps</i> )</li>
<li><div class="fn"/>QString <b><a href="qabstractspinbox.html#text-prop">text</a></b> () const</li>
<li><div class="fn"/>virtual QValidator::State <b><a href="qabstractspinbox.html#validate">validate</a></b> ( QString &amp; <i>input</i>, int &amp; <i>pos</i> ) const</li>
<li><div class="fn"/>bool <b><a href="qabstractspinbox.html#wrapping-prop">wrapping</a></b> () const</li>
</ul>
<ul>
<li><div class="fn"/>201 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li><div class="fn"/>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
<li><div class="fn"/>12 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="public-slots"></a>
<h3>Public Slots</h3>
<ul>
<li><div class="fn"/>virtual void <b><a href="qabstractspinbox.html#clear">clear</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#selectAll">selectAll</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#stepDown">stepDown</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#stepUp">stepUp</a></b> ()</li>
</ul>
<ul>
<li><div class="fn"/>19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h3>Signals</h3>
<ul>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#editingFinished">editingFinished</a></b> ()</li>
</ul>
<ul>
<li><div class="fn"/>1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h3>Protected Functions</h3>
<ul>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#initStyleOption">initStyleOption</a></b> ( QStyleOptionSpinBox * <i>option</i> ) const</li>
<li><div class="fn"/>QLineEdit * <b><a href="qabstractspinbox.html#lineEdit">lineEdit</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qabstractspinbox.html#setLineEdit">setLineEdit</a></b> ( QLineEdit * <i>lineEdit</i> )</li>
<li><div class="fn"/>virtual StepEnabled <b><a href="qabstractspinbox.html#stepEnabled">stepEnabled</a></b> () const</li>
</ul>
<ul>
<li><div class="fn"/>38 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
<li><div class="fn"/>1 protected function inherited from <a href="qpaintdevice.html#protected-functions">QPaintDevice</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"/>4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li><div class="fn"/>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"/>1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QAbstractSpinBox class provides a spinbox and a line edit to display values.</p>
<p>The class is designed as a common super class for widgets like <a href="qspinbox.html">QSpinBox</a>, <a href="qdoublespinbox.html">QDoubleSpinBox</a> and <a href="qdatetimeedit.html">QDateTimeEdit</a></p>
<p>Here are the main properties of the class:</p>
<ol type="1">
<li><a href="qabstractspinbox.html#text-prop">text</a>: The text that is displayed in the QAbstractSpinBox.</li>
<li><a href="qabstractspinbox.html#alignment-prop">alignment</a>: The alignment of the text in the QAbstractSpinBox.</li>
<li><a href="qabstractspinbox.html#wrapping-prop">wrapping</a>: Whether the QAbstractSpinBox wraps from the minimum value to the maximum value and vica versa.</li>
</ol>
<p>QAbstractSpinBox provides a virtual <a href="qabstractspinbox.html#stepBy">stepBy</a>() function that is called whenever the user triggers a step. This function takes an integer value to signify how many steps were taken. E.g&#x2e; Pressing <a href="qt.html#Key-enum">Qt::Key_Down</a> will trigger a call to stepBy(-1).</p>
<p>QAbstractSpinBox also provide a virtual function <a href="qabstractspinbox.html#stepEnabled">stepEnabled</a>() to determine whether stepping up/down is allowed at any point. This function returns a bitset of <a href="qabstractspinbox.html#StepEnabledFlag-enum">StepEnabled</a>.</p>
<p>See also <a href="qabstractslider.html">QAbstractSlider</a>, <a href="qspinbox.html">QSpinBox</a>, <a href="qdoublespinbox.html">QDoubleSpinBox</a>, <a href="qdatetimeedit.html">QDateTimeEdit</a>, and <a href="widgets-spinboxes.html">Spin Boxes Example</a>.</p>
<hr />
<h2>Member Type Documentation</h2>
<h3 class="fn"><a name="ButtonSymbols-enum"></a>enum QAbstractSpinBox::ButtonSymbols</h3>
<p>This enum type describes the symbols that can be displayed on the buttons in a spin box.</p>
<p><img src="images/qspinbox-updown.png" /> <img src="images/qspinbox-plusminus.png" /></p>
<p><table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QAbstractSpinBox::UpDownArrows</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">Little arrows in the classic style.</td></tr>
<tr><td valign="top"><tt>QAbstractSpinBox::PlusMinus</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top"><b>+</b> and <b>-</b> symbols.</td></tr>
<tr><td valign="top"><tt>QAbstractSpinBox::NoButtons</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">Don't display buttons.</td></tr>
</table></p>
<p>See also <a href="qabstractspinbox.html#buttonSymbols-prop">QAbstractSpinBox::buttonSymbols</a>.</p>
<h3 class="fn"><a name="CorrectionMode-enum"></a>enum QAbstractSpinBox::CorrectionMode</h3>
<p>This enum type describes the mode the spinbox will use to correct an <a href="qvalidator.html#State-enum">Intermediate</a> value if editing finishes.</p>
<p><table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QAbstractSpinBox::CorrectToPreviousValue</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">The spinbox will revert to the last valid value.</td></tr>
<tr><td valign="top"><tt>QAbstractSpinBox::CorrectToNearestValue</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The spinbox will revert to the nearest valid value.</td></tr>
</table></p>
<p>See also <a href="qabstractspinbox.html#correctionMode-prop">correctionMode</a>.</p>
<h3 class="flags"><a name="StepEnabledFlag-enum"></a>enum QAbstractSpinBox::StepEnabledFlag<br />flags QAbstractSpinBox::StepEnabled</h3>
<p><table border="1" cellpadding="2" cellspacing="1" width="40%">
<tr><th width="60%">Constant</th><th width="40%">Value</th></tr>
<tr><td valign="top"><tt>QAbstractSpinBox::StepNone</tt></td><td align="center" valign="top"><tt>0x00</tt></td></tr>
<tr><td valign="top"><tt>QAbstractSpinBox::StepUpEnabled</tt></td><td align="center" valign="top"><tt>0x01</tt></td></tr>
<tr><td valign="top"><tt>QAbstractSpinBox::StepDownEnabled</tt></td><td align="center" valign="top"><tt>0x02</tt></td></tr>
</table></p>
<p>The StepEnabled type is a typedef for <a href="qflags.html">QFlags</a>&lt;StepEnabledFlag&gt;. It stores an OR combination of StepEnabledFlag values.</p>
<hr />
<h2>Property Documentation</h2>
<h3 class="fn"><a name="accelerated-prop"></a>accelerated : bool</h3>
<p>This property holds whether the spin box will accelerate the frequency of the steps when pressing the step Up/Down buttons.</p>
<p>If enabled the spin box will increase/decrease the value faster the longer you hold the button down.</p>
<p>This property was introduced in Qt 4.2.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>bool isAccelerated () const</b></li>
<li><div class="fn"/><b>void setAccelerated ( bool <i>on</i> )</b></li>
</ul>
<h3 class="fn"><a name="acceptableInput-prop"></a>acceptableInput : const bool</h3>
<p>This property holds whether the input satisfies the current validation.</p>
<p>This property was introduced in Qt 4.2.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>bool hasAcceptableInput () const</b></li>
</ul>
<p>See also <a href="qabstractspinbox.html#validate">validate</a>(), <a href="qabstractspinbox.html#fixup">fixup</a>(), and <a href="qabstractspinbox.html#correctionMode-prop">correctionMode</a>.</p>
<h3 class="fn"><a name="alignment-prop"></a>alignment : <a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a></h3>
<p>This property holds the alignment of the spin box.</p>
<p>Possible Values are <a href="qt.html#AlignmentFlag-enum">Qt::AlignLeft</a>, <a href="qt.html#AlignmentFlag-enum">Qt::AlignRight</a>, and <a href="qt.html#AlignmentFlag-enum">Qt::AlignHCenter</a>.</p>
<p>By default, the alignment is <a href="qt.html#AlignmentFlag-enum">Qt::AlignLeft</a></p>
<p>Attempting to set the alignment to an illegal flag combination does nothing.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>Qt::Alignment alignment () const</b></li>
<li><div class="fn"/><b>void setAlignment ( Qt::Alignment <i>flag</i> )</b></li>
</ul>
<p>See also <a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a>.</p>
<h3 class="fn"><a name="buttonSymbols-prop"></a>buttonSymbols : <a href="qabstractspinbox.html#ButtonSymbols-enum">ButtonSymbols</a></h3>
<p>This property holds the current button symbol mode.</p>
<p>The possible values can be either <tt>UpDownArrows</tt> or <tt>PlusMinus</tt>. The default is <tt>UpDownArrows</tt>.</p>
<p>Note that some styles might render <a href="qabstractspinbox.html#ButtonSymbols-enum">PlusMinus</a> and <a href="qabstractspinbox.html#ButtonSymbols-enum">UpDownArrows</a> identically.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>ButtonSymbols buttonSymbols () const</b></li>
<li><div class="fn"/><b>void setButtonSymbols ( ButtonSymbols <i>bs</i> )</b></li>
</ul>
<p>See also <a href="qabstractspinbox.html#ButtonSymbols-enum">ButtonSymbols</a>.</p>
<h3 class="fn"><a name="correctionMode-prop"></a>correctionMode : <a href="qabstractspinbox.html#CorrectionMode-enum">CorrectionMode</a></h3>
<p>This property holds the mode to correct an Intermediate value if editing finishes.</p>
<p>The default mode is <a href="qabstractspinbox.html#CorrectionMode-enum">QAbstractSpinBox::CorrectToPreviousValue</a>.</p>
<p>This property was introduced in Qt 4.2.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>CorrectionMode correctionMode () const</b></li>
<li><div class="fn"/><b>void setCorrectionMode ( CorrectionMode <i>cm</i> )</b></li>
</ul>
<p>See also <a href="qabstractspinbox.html#acceptableInput-prop">acceptableInput</a>, <a href="qabstractspinbox.html#validate">validate</a>(), and <a href="qabstractspinbox.html#fixup">fixup</a>().</p>
<h3 class="fn"><a name="frame-prop"></a>frame : bool</h3>
<p>This property holds whether the spin box draws itself with a frame.</p>
<p>If enabled (the default) the spin box draws itself inside a frame, otherwise the spin box draws itself without any frame.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>bool hasFrame () const</b></li>
<li><div class="fn"/><b>void setFrame ( bool )</b></li>
</ul>
<h3 class="fn"><a name="keyboardTracking-prop"></a>keyboardTracking : bool</h3>
<p>This property holds whether keyboard tracking is enabled for the spinbox.</p>
<p>If keyboard tracking is enabled (the default), the spinbox emits the valueChanged() signal while the new value is being entered from the keyboard.</p>
<p>E.g&#x2e; when the user enters the value 600 by typing 6, 0, and 0, the spinbox emits 3 signals with the values 6, 60, and 600 respectively.</p>
<p>If keyboard tracking is disabled, the spinbox doesn't emit the valueChanged() signal while typing. It emits the signal later, when the return key is pressed, when keyboard focus is lost, or when other spinbox functionality is used, e.g&#x2e; pressing an arrow key.</p>
<p>This property was introduced in Qt 4.3.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>bool keyboardTracking () const</b></li>
<li><div class="fn"/><b>void setKeyboardTracking ( bool <i>kt</i> )</b></li>
</ul>
<h3 class="fn"><a name="readOnly-prop"></a>readOnly : bool</h3>
<p>This property holds whether the spin box is read only.</p>
<p>In read-only mode, the user can still copy the text to the clipboard, or drag and drop the text; but cannot edit it.</p>
<p>The <a href="qlineedit.html">QLineEdit</a> in the <a href="qabstractspinbox.html">QAbstractSpinBox</a> does not show a cursor in read-only mode.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>bool isReadOnly () const</b></li>
<li><div class="fn"/><b>void setReadOnly ( bool <i>r</i> )</b></li>
</ul>
<p>See also <a href="qlineedit.html#readOnly-prop">QLineEdit::readOnly</a>.</p>
<h3 class="fn"><a name="specialValueText-prop"></a>specialValueText : <a href="qstring.html">QString</a></h3>
<p>This property holds the special-value text.</p>
<p>If set, the spin box will display this text instead of a numeric value whenever the current value is equal to minimum(). Typical use is to indicate that this choice has a special (default) meaning.</p>
<p>For example, if your spin box allows the user to choose a scale factor (or zoom level) for displaying an image, and your application is able to automatically choose one that will enable the image to fit completely within the display window, you can set up the spin box like this:</p>
<pre>     QSpinBox *zoomSpinBox = new QSpinBox;
     zoomSpinBox-&gt;setRange(0, 1000);
     zoomSpinBox-&gt;setSingleStep(10);
     zoomSpinBox-&gt;setSuffix(&quot;%&quot;);
     zoomSpinBox-&gt;setSpecialValueText(tr(&quot;Automatic&quot;));
     zoomSpinBox-&gt;setValue(100);</pre>
<p>The user will then be able to choose a scale from 1% to 1000% or select &quot;Auto&quot; to leave it up to the application to choose. Your code must then interpret the spin box value of 0 as a request from the user to scale the image to fit inside the window.</p>
<p>All values are displayed with the prefix and suffix (if set), <i>except</i> for the special value, which only shows the special value text. This special text is passed in the <a href="qspinbox.html#valueChanged">QSpinBox::valueChanged</a>() signal that passes a <a href="qstring.html">QString</a>.</p>
<p>To turn off the special-value text display, call this function with an empty string. The default is no special-value text, i.e&#x2e; the numeric value is shown as usual.</p>
<p>If no special-value text is set, specialValueText() returns an empty string.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>QString specialValueText () const</b></li>
<li><div class="fn"/><b>void setSpecialValueText ( const QString &amp; <i>txt</i> )</b></li>
</ul>
<h3 class="fn"><a name="text-prop"></a>text : const <a href="qstring.html">QString</a></h3>
<p>This property holds the spin box's text, including any prefix and suffix.</p>
<p>There is no default text.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>QString text () const</b></li>
</ul>
<h3 class="fn"><a name="wrapping-prop"></a>wrapping : bool</h3>
<p>This property holds whether the spin box is circular.</p>
<p>If wrapping is true stepping up from maximum() value will take you to the minimum() value and vica versa. Wrapping only make sense if you have minimum() and maximum() values set.</p>
<pre> QSpinBox *spinBox = new QSpinBox(this);
 spinBox-&gt;setRange(0, 100);
 spinBox-&gt;setWrapping(true);
 spinBox-&gt;setValue(100);
 spinBox-&gt;stepBy(1);
<span class="comment"> //</span> value is 0</pre>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>bool wrapping () const</b></li>
<li><div class="fn"/><b>void setWrapping ( bool <i>w</i> )</b></li>
</ul>
<p>See also <a href="qspinbox.html#minimum-prop">QSpinBox::minimum</a>() and <a href="qspinbox.html#maximum-prop">QSpinBox::maximum</a>().</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QAbstractSpinBox"></a>QAbstractSpinBox::QAbstractSpinBox ( <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0 )</h3>
<p>Constructs an abstract spinbox with the given <i>parent</i> with default <a href="qabstractspinbox.html#wrapping-prop">wrapping</a>, and <a href="qabstractspinbox.html#alignment-prop">alignment</a> properties.</p>
<h3 class="fn"><a name="dtor.QAbstractSpinBox"></a>QAbstractSpinBox::~QAbstractSpinBox ()</h3>
<p>Called when the <a href="qabstractspinbox.html">QAbstractSpinBox</a> is destroyed.</p>
<h3 class="fn"><a name="clear"></a>void QAbstractSpinBox::clear ()&nbsp;&nbsp;<tt> [virtual slot]</tt></h3>
<p>Clears the lineedit of all text but prefix and suffix.</p>
<h3 class="fn"><a name="editingFinished"></a>void QAbstractSpinBox::editingFinished ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
<p>This signal is emitted editing is finished. This happens when the spinbox loses focus and when enter is pressed.</p>
<h3 class="fn"><a name="fixup"></a>void QAbstractSpinBox::fixup ( <a href="qstring.html">QString</a> &amp; <i>input</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>This virtual function is called by the <a href="qabstractspinbox.html">QAbstractSpinBox</a> if the <i>input</i> is not validated to <a href="qvalidator.html#State-enum">QValidator::Acceptable</a> when Return is pressed or <a href="qabstractspinbox.html#interpretText">interpretText</a>() is called. It will try to change the text so it is valid. Reimplemented in the various subclasses.</p>
<h3 class="fn"><a name="initStyleOption"></a>void QAbstractSpinBox::initStyleOption ( <a href="qstyleoptionspinbox.html">QStyleOptionSpinBox</a> * <i>option</i> ) const&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Initialize <i>option</i> with the values from this <a href="qspinbox.html">QSpinBox</a>. This method is useful for subclasses when they need a <a href="qstyleoptionspinbox.html">QStyleOptionSpinBox</a>, but don't want to fill in all the information themselves.</p>
<p>See also <a href="qstyleoption.html#initFrom">QStyleOption::initFrom</a>().</p>
<h3 class="fn"><a name="interpretText"></a>void QAbstractSpinBox::interpretText ()</h3>
<p>This function interprets the text of the spin box. If the value has changed since last interpretation it will emit signals.</p>
<h3 class="fn"><a name="lineEdit"></a><a href="qlineedit.html">QLineEdit</a> * QAbstractSpinBox::lineEdit () const&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>This function returns a pointer to the line edit of the spin box.</p>
<p>See also <a href="qabstractspinbox.html#setLineEdit">setLineEdit</a>().</p>
<h3 class="fn"><a name="selectAll"></a>void QAbstractSpinBox::selectAll ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Selects all the text in the spinbox except the prefix and suffix.</p>
<h3 class="fn"><a name="setLineEdit"></a>void QAbstractSpinBox::setLineEdit ( <a href="qlineedit.html">QLineEdit</a> * <i>lineEdit</i> )&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Sets the line edit of the spinbox to be <i>lineEdit</i> instead of the current line edit widget. <i>lineEdit</i> can not be 0.</p>
<p><a href="qabstractspinbox.html">QAbstractSpinBox</a> takes ownership of the new lineEdit</p>
<p>If <a href="qlineedit.html#validator">QLineEdit::validator</a>() for the <i>lineEdit</i> returns 0, the internal validator of the spinbox will be set on the line edit.</p>
<p>See also <a href="qabstractspinbox.html#lineEdit">lineEdit</a>().</p>
<h3 class="fn"><a name="stepBy"></a>void QAbstractSpinBox::stepBy ( int <i>steps</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Virtual function that is called whenever the user triggers a step. The <i>steps</i> parameter indicates how many steps were taken, e.g&#x2e; Pressing <a href="qt.html#Key-enum">Qt::Key_Down</a> will trigger a call to stepBy(-1), whereas pressing <a href="qt.html#Key-enum">Qt::Key_Prior</a> will trigger a call to stepBy(10).</p>
<p>If you subclass <a href="qabstractspinbox.html">QAbstractSpinBox</a> you must reimplement this function. Note that this function is called even if the resulting value will be outside the bounds of minimum and maximum. It's this function's job to handle these situations.</p>
<h3 class="fn"><a name="stepDown"></a>void QAbstractSpinBox::stepDown ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Steps down by one linestep Calling this slot is analogous to calling stepBy(-1);</p>
<p>See also <a href="qabstractspinbox.html#stepBy">stepBy</a>() and <a href="qabstractspinbox.html#stepUp">stepUp</a>().</p>
<h3 class="fn"><a name="stepEnabled"></a><a href="qabstractspinbox.html#StepEnabledFlag-enum">StepEnabled</a> QAbstractSpinBox::stepEnabled () const&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Virtual function that determines whether stepping up and down is legal at any given time.</p>
<p>The up arrow will be painted as disabled unless (stepEnabled() &amp; <a href="qabstractspinbox.html#StepEnabledFlag-enum">StepUpEnabled</a>) != 0.</p>
<p>The default implementation will return (<a href="qabstractspinbox.html#StepEnabledFlag-enum">StepUpEnabled</a>| <a href="qabstractspinbox.html#StepEnabledFlag-enum">StepDownEnabled</a>) if wrapping is turned on. Else it will return <a href="qabstractspinbox.html#StepEnabledFlag-enum">StepDownEnabled</a> if value is &gt; minimum() or'ed with <a href="qabstractspinbox.html#StepEnabledFlag-enum">StepUpEnabled</a> if value &lt; maximum().</p>
<p>If you subclass <a href="qabstractspinbox.html">QAbstractSpinBox</a> you will need to reimplement this function.</p>
<p>See also <a href="qspinbox.html#minimum-prop">QSpinBox::minimum</a>(), <a href="qspinbox.html#maximum-prop">QSpinBox::maximum</a>(), and <a href="qabstractspinbox.html#wrapping-prop">wrapping</a>().</p>
<h3 class="fn"><a name="stepUp"></a>void QAbstractSpinBox::stepUp ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Steps up by one linestep Calling this slot is analogous to calling stepBy(1);</p>
<p>See also <a href="qabstractspinbox.html#stepBy">stepBy</a>() and <a href="qabstractspinbox.html#stepDown">stepDown</a>().</p>
<h3 class="fn"><a name="validate"></a><a href="qvalidator.html#State-enum">QValidator::State</a> QAbstractSpinBox::validate ( <a href="qstring.html">QString</a> &amp; <i>input</i>, int &amp; <i>pos</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>This virtual function is called by the <a href="qabstractspinbox.html">QAbstractSpinBox</a> to determine whether <i>input</i> is valid. The <i>pos</i> parameter indicates the position in the string. Reimplemented in the various subclasses.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
